package com.srit.recipes.controller;

import com.srit.recipes.common.response.Response;
import com.srit.recipes.service.RecipesAnalysis;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "食谱分析")
public class RecipesAnalysisController {

    @Autowired
    private RecipesAnalysis recipesAnalysis;


    @GetMapping("/recipes/overview/nutrition/{id}")
    @ApiOperation("1 食谱营养成分分析 type: 计算方式 0 按周 1 按天")
    public Response recipesNutritionAnalysis(@PathVariable Integer id, int type) {
        return Response.success(recipesAnalysis.recipesNutritionAnalysis(id, type));
    }



    @GetMapping("/recipes/overview/ingredient/{id}")
    @ApiOperation("2 食谱原材料统计")
    public Response recipesIngredientAnalysis(@PathVariable Integer id) {
        return Response.success(recipesAnalysis.recipesIngredientAnalysis(id));
    }


    @GetMapping("/recipes/cost/{id}")
    @ApiOperation("3 人均成本分析")
    public Response recipesCost(@PathVariable Integer id) {
        return Response.success(recipesAnalysis.recipesCost(id));
    }








}
